package experiment.e02.code;

/**
 * @author thinkpad - 83start
 * @version v1.0
 * @create 2022/9/22 15:46
 * @package experiment.e02.code
 * @description s=1-2+3-4+…+99-100。
 */

public class E05 {

    public static void main(String[] args) {

        int sum = 0;
        for (int i = 1; i <= 100 ; i++) {
            // 判断奇数偶数，累加计算
            if (i%2 == 0){
                sum += (-1 * i);
            }
            else {
                sum += i;
            }
        }
        System.out.println(sum);
    }
}
